home *** CD-ROM | disk | FTP | other *** search
- Path: howland.reston.ans.net!agate!tmonroe
- From: tmonroe@po.EECS.Berkeley.EDU (Tony Monroe)
- Newsgroups: comp.lang.c++
- Subject: Re: delete
- Date: 7 Feb 1996 05:23:27 GMT
- Organization: University of California, Berkeley
- Message-ID: <4f9d0f$o3e@agate.berkeley.edu>
- References: <DMDBqB.Bw5@undergrad.math.uwaterloo.ca>
- NNTP-Posting-Host: po.eecs.berkeley.edu
-
- In article <DMDBqB.Bw5@undergrad.math.uwaterloo.ca>,
- Steve Kettle <sckettle@undergrad.math.uwaterloo.ca> wrote:
- >
- > Is there anyway to force a deleted pointer to be zero or are we just
- > at mercy of the compiler implementation?
-
- void f()
- {
- Thing *foo;
- foo = new Thing("blurfl");
- //
- // bunch o' code
- //
- delete foo;
- foo = NULL; // assuming #define NULL 0 or something equivalent
- }
-
- Yes, it is up to the compiler. Personally, I would not bet on the compiler
- zeroing the pointer for you. Besides, playing with memory you don't have
- can be hazardous to your program's (or, in more extreme cases, computer's)
- health.
-
- --
- Tony Monroe |
- "Experimental Non-Rabbit" | This space for rent
- tmonroe@cory.eecs.berkeley.edu | Unreasonable rates available
- http://www.csua.berkeley.edu/~tmonroe |
-